<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>GResource: GIO Reference Manual</title>
<meta name="generator" content="DocBook XSL Stylesheets V1.79.1">
<link rel="home" href="index.html" title="GIO Reference Manual">
<link rel="up" href="resources.html" title="Resources">
<link rel="prev" href="resources.html" title="Resources">
<link rel="next" href="permissions.html" title="Permissions">
<meta name="generator" content="GTK-Doc V1.24 (XML mode)">
<link rel="stylesheet" href="style.css" type="text/css">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
<table class="navigation" id="top" width="100%" summary="Navigation header" cellpadding="2" cellspacing="5"><tr valign="middle">
<td width="100%" align="left" class="shortcuts">
<a href="#" class="shortcut">Top</a><span id="nav_description">  <span class="dim">|</span> 
                  <a href="#GResource.description" class="shortcut">Description</a></span><span id="nav_hierarchy">  <span class="dim">|</span> 
                  <a href="#GResource.object-hierarchy" class="shortcut">Object Hierarchy</a></span>
</td>
<td><a accesskey="h" href="index.html"><img src="home.png" width="16" height="16" border="0" alt="Home"></a></td>
<td><a accesskey="u" href="resources.html"><img src="up.png" width="16" height="16" border="0" alt="Up"></a></td>
<td><a accesskey="p" href="resources.html"><img src="left.png" width="16" height="16" border="0" alt="Prev"></a></td>
<td><a accesskey="n" href="permissions.html"><img src="right.png" width="16" height="16" border="0" alt="Next"></a></td>
</tr></table>
<div class="refentry">
<a name="GResource"></a><div class="titlepage"></div>
<div class="refnamediv"><table width="100%"><tr>
<td valign="top">
<h2><span class="refentrytitle"><a name="GResource.top_of_page"></a>GResource</span></h2>
<p>GResource — Resource framework</p>
</td>
<td class="gallery_image" valign="top" align="right"></td>
</tr></table></div>
<div class="refsect1">
<a name="GResource.functions"></a><h2>Functions</h2>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="functions_return">
<col class="functions_name">
</colgroup>
<tbody>
<tr>
<td class="function_type">
<a class="link" href="GResource.html" title="GResource"><span class="returnvalue">GResource</span></a> *
</td>
<td class="function_name">
<a class="link" href="GResource.html#g-resource-load" title="g_resource_load ()">g_resource_load</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<a class="link" href="GResource.html" title="GResource"><span class="returnvalue">GResource</span></a> *
</td>
<td class="function_name">
<a class="link" href="GResource.html#g-resource-new-from-data" title="g_resource_new_from_data ()">g_resource_new_from_data</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<a class="link" href="GResource.html" title="GResource"><span class="returnvalue">GResource</span></a> *
</td>
<td class="function_name">
<a class="link" href="GResource.html#g-resource-ref" title="g_resource_ref ()">g_resource_ref</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<span class="returnvalue">void</span>
</td>
<td class="function_name">
<a class="link" href="GResource.html#g-resource-unref" title="g_resource_unref ()">g_resource_unref</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<a href="https://developer.gnome.org/glib/unstable/glib-Byte-Arrays.html#GBytes"><span class="returnvalue">GBytes</span></a> *
</td>
<td class="function_name">
<a class="link" href="GResource.html#g-resource-lookup-data" title="g_resource_lookup_data ()">g_resource_lookup_data</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<a class="link" href="GInputStream.html" title="GInputStream"><span class="returnvalue">GInputStream</span></a> *
</td>
<td class="function_name">
<a class="link" href="GResource.html#g-resource-open-stream" title="g_resource_open_stream ()">g_resource_open_stream</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<span class="returnvalue">char</span> **
</td>
<td class="function_name">
<a class="link" href="GResource.html#g-resource-enumerate-children" title="g_resource_enumerate_children ()">g_resource_enumerate_children</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>
</td>
<td class="function_name">
<a class="link" href="GResource.html#g-resource-get-info" title="g_resource_get_info ()">g_resource_get_info</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<span class="returnvalue">void</span>
</td>
<td class="function_name">
<a class="link" href="GResource.html#g-static-resource-init" title="g_static_resource_init ()">g_static_resource_init</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<span class="returnvalue">void</span>
</td>
<td class="function_name">
<a class="link" href="GResource.html#g-static-resource-fini" title="g_static_resource_fini ()">g_static_resource_fini</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<a class="link" href="GResource.html" title="GResource"><span class="returnvalue">GResource</span></a> *
</td>
<td class="function_name">
<a class="link" href="GResource.html#g-static-resource-get-resource" title="g_static_resource_get_resource ()">g_static_resource_get_resource</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<span class="returnvalue">void</span>
</td>
<td class="function_name">
<a class="link" href="GResource.html#g-resources-register" title="g_resources_register ()">g_resources_register</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<span class="returnvalue">void</span>
</td>
<td class="function_name">
<a class="link" href="GResource.html#g-resources-unregister" title="g_resources_unregister ()">g_resources_unregister</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<a href="https://developer.gnome.org/glib/unstable/glib-Byte-Arrays.html#GBytes"><span class="returnvalue">GBytes</span></a> *
</td>
<td class="function_name">
<a class="link" href="GResource.html#g-resources-lookup-data" title="g_resources_lookup_data ()">g_resources_lookup_data</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<a class="link" href="GInputStream.html" title="GInputStream"><span class="returnvalue">GInputStream</span></a> *
</td>
<td class="function_name">
<a class="link" href="GResource.html#g-resources-open-stream" title="g_resources_open_stream ()">g_resources_open_stream</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<span class="returnvalue">char</span> **
</td>
<td class="function_name">
<a class="link" href="GResource.html#g-resources-enumerate-children" title="g_resources_enumerate_children ()">g_resources_enumerate_children</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>
</td>
<td class="function_name">
<a class="link" href="GResource.html#g-resources-get-info" title="g_resources_get_info ()">g_resources_get_info</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="define_keyword">#define</td>
<td class="function_name"><a class="link" href="GResource.html#G-RESOURCE-ERROR:CAPS" title="G_RESOURCE_ERROR">G_RESOURCE_ERROR</a></td>
</tr>
</tbody>
</table></div>
</div>
<div class="refsect1">
<a name="GResource.other"></a><h2>Types and Values</h2>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="name">
<col class="description">
</colgroup>
<tbody>
<tr>
<td class="datatype_keyword"> </td>
<td class="function_name"><a class="link" href="GResource.html#GResource-struct" title="GResource">GResource</a></td>
</tr>
<tr>
<td class="datatype_keyword">enum</td>
<td class="function_name"><a class="link" href="GResource.html#GResourceFlags" title="enum GResourceFlags">GResourceFlags</a></td>
</tr>
<tr>
<td class="datatype_keyword">enum</td>
<td class="function_name"><a class="link" href="GResource.html#GResourceLookupFlags" title="enum GResourceLookupFlags">GResourceLookupFlags</a></td>
</tr>
<tr>
<td class="datatype_keyword">struct</td>
<td class="function_name"><a class="link" href="GResource.html#GStaticResource" title="struct GStaticResource">GStaticResource</a></td>
</tr>
<tr>
<td class="datatype_keyword">enum</td>
<td class="function_name"><a class="link" href="GResource.html#GResourceError" title="enum GResourceError">GResourceError</a></td>
</tr>
</tbody>
</table></div>
</div>
<div class="refsect1">
<a name="GResource.object-hierarchy"></a><h2>Object Hierarchy</h2>
<pre class="screen">    <a href="https://developer.gnome.org/gobject/unstable/gobject-Boxed-Types.html">GBoxed</a>
    <span class="lineart">╰──</span> GResource
</pre>
</div>
<div class="refsect1">
<a name="GResource.includes"></a><h2>Includes</h2>
<pre class="synopsis">#include &lt;gio/gio.h&gt;
</pre>
</div>
<div class="refsect1">
<a name="GResource.description"></a><h2>Description</h2>
<p>Applications and libraries often contain binary or textual data that is
really part of the application, rather than user data. For instance
<a href="http://developer.gnome.org/gtk2/GtkBuilder.html"><span class="type">GtkBuilder</span></a> .ui files, splashscreen images, GMenu markup XML, CSS files,
icons, etc. These are often shipped as files in <code class="literal">$datadir/appname</code>, or
manually included as literal strings in the code.</p>
<p>The <a class="link" href="GResource.html" title="GResource"><span class="type">GResource</span></a> API and the <a href="glib-compile-resources.html">glib-compile-resources</a> program
provide a convenient and efficient alternative to this which has some nice properties. You
maintain the files as normal files, so its easy to edit them, but during the build the files
are combined into a binary bundle that is linked into the executable. This means that loading
the resource files are efficient (as they are already in memory, shared with other instances) and
simple (no need to check for things like I/O errors or locate the files in the filesystem). It
also makes it easier to create relocatable applications.</p>
<p>Resource files can also be marked as compressed. Such files will be included in the resource bundle
in a compressed form, but will be automatically uncompressed when the resource is used. This
is very useful e.g. for larger text files that are parsed once (or rarely) and then thrown away.</p>
<p>Resource files can also be marked to be preprocessed, by setting the value of the
<code class="literal">preprocess</code> attribute to a comma-separated list of preprocessing options.
The only options currently supported are:</p>
<p><code class="literal">xml-stripblanks</code> which will use the xmllint command
to strip ignorable whitespace from the XML file. For this to work,
the <code class="literal">XMLLINT</code> environment variable must be set to the full path to
the xmllint executable, or xmllint must be in the <code class="literal">PATH</code>; otherwise
the preprocessing step is skipped.</p>
<p><code class="literal">to-pixdata</code> which will use the gdk-pixbuf-pixdata command to convert
images to the GdkPixdata format, which allows you to create pixbufs directly using the data inside
the resource file, rather than an (uncompressed) copy if it. For this, the gdk-pixbuf-pixdata
program must be in the PATH, or the <code class="literal">GDK_PIXBUF_PIXDATA</code> environment variable must be
set to the full path to the gdk-pixbuf-pixdata executable; otherwise the resource compiler will
abort.</p>
<p>Resource bundles are created by the <a href="glib-compile-resources.html">glib-compile-resources</a> program
which takes an XML file that describes the bundle, and a set of files that the XML references. These
are combined into a binary resource bundle.</p>
<p>An example resource description:</p>
<div class="informalexample">
  <table class="listing_frame" border="0" cellpadding="0" cellspacing="0">
    <tbody>
      <tr>
        <td class="listing_lines" align="right"><pre>1
2
3
4
5
6
7
8</pre></td>
        <td class="listing_code"><pre class="programlisting"><span class="gtkdoc opt">&lt;</span>?xml version<span class="gtkdoc opt">=</span><span class="string">&quot;1.0&quot;</span> encoding<span class="gtkdoc opt">=</span><span class="string">&quot;UTF-8&quot;</span>?<span class="gtkdoc opt">&gt;</span>
<span class="gtkdoc opt">&lt;</span>gresources<span class="gtkdoc opt">&gt;</span>
  <span class="gtkdoc opt">&lt;</span>gresource prefix<span class="gtkdoc opt">=</span><span class="string">&quot;/org/gtk/Example&quot;</span><span class="gtkdoc opt">&gt;</span>
    <span class="gtkdoc opt">&lt;</span>file<span class="gtkdoc opt">&gt;</span>data<span class="gtkdoc opt">/</span>splashscreen<span class="gtkdoc opt">.</span>png<span class="gtkdoc opt">&lt;/</span>file<span class="gtkdoc opt">&gt;</span>
    <span class="gtkdoc opt">&lt;</span>file compressed<span class="gtkdoc opt">=</span><span class="string">&quot;true&quot;</span><span class="gtkdoc opt">&gt;</span>dialog<span class="gtkdoc opt">.</span>ui<span class="gtkdoc opt">&lt;/</span>file<span class="gtkdoc opt">&gt;</span>
    <span class="gtkdoc opt">&lt;</span>file preprocess<span class="gtkdoc opt">=</span><span class="string">&quot;xml-stripblanks&quot;</span><span class="gtkdoc opt">&gt;</span>menumarkup<span class="gtkdoc opt">.</span>xml<span class="gtkdoc opt">&lt;/</span>file<span class="gtkdoc opt">&gt;</span>
  <span class="gtkdoc opt">&lt;/</span>gresource<span class="gtkdoc opt">&gt;</span>
<span class="gtkdoc opt">&lt;/</span>gresources<span class="gtkdoc opt">&gt;</span></pre></td>
      </tr>
    </tbody>
  </table>
</div>

<p></p>
<p>This will create a resource bundle with the following files:</p>
<div class="informalexample">
  <table class="listing_frame" border="0" cellpadding="0" cellspacing="0">
    <tbody>
      <tr>
        <td class="listing_lines" align="right"><pre>1
2
3</pre></td>
        <td class="listing_code"><pre class="programlisting"><span class="gtkdoc opt">/</span>org<span class="gtkdoc opt">/</span>gtk<span class="gtkdoc opt">/</span>Example<span class="gtkdoc opt">/</span>data<span class="gtkdoc opt">/</span>splashscreen<span class="gtkdoc opt">.</span>png
<span class="gtkdoc opt">/</span>org<span class="gtkdoc opt">/</span>gtk<span class="gtkdoc opt">/</span>Example<span class="gtkdoc opt">/</span>dialog<span class="gtkdoc opt">.</span>ui
<span class="gtkdoc opt">/</span>org<span class="gtkdoc opt">/</span>gtk<span class="gtkdoc opt">/</span>Example<span class="gtkdoc opt">/</span>menumarkup<span class="gtkdoc opt">.</span>xml</pre></td>
      </tr>
    </tbody>
  </table>
</div>

<p></p>
<p>Note that all resources in the process share the same namespace, so use Java-style
path prefixes (like in the above example) to avoid conflicts.</p>
<p>You can then use <a href="glib-compile-resources.html">glib-compile-resources</a> to compile the XML to a
binary bundle that you can load with <a class="link" href="GResource.html#g-resource-load" title="g_resource_load ()"><code class="function">g_resource_load()</code></a>. However, its more common to use the --generate-source and
--generate-header arguments to create a source file and header to link directly into your application.
This will generate <code class="literal"><code class="function">get_resource()</code></code>, <code class="literal"><code class="function">register_resource()</code></code> and
<code class="literal"><code class="function">unregister_resource()</code></code> functions, prefixed by the <code class="literal">--c-name</code> argument passed
to <a href="glib-compile-resources.html">glib-compile-resources</a>. <code class="literal"><code class="function">get_resource()</code></code> returns
the generated <a class="link" href="GResource.html" title="GResource"><span class="type">GResource</span></a> object. The register and unregister functions
register the resource so its files can be accessed using
<a class="link" href="GResource.html#g-resources-lookup-data" title="g_resources_lookup_data ()"><code class="function">g_resources_lookup_data()</code></a>.</p>
<p>Once a <a class="link" href="GResource.html" title="GResource"><span class="type">GResource</span></a> has been created and registered all the data in it can be accessed globally in the process by
using API calls like <a class="link" href="GResource.html#g-resources-open-stream" title="g_resources_open_stream ()"><code class="function">g_resources_open_stream()</code></a> to stream the data or <a class="link" href="GResource.html#g-resources-lookup-data" title="g_resources_lookup_data ()"><code class="function">g_resources_lookup_data()</code></a> to get a direct pointer
to the data. You can also use URIs like "resource:///org/gtk/Example/data/splashscreen.png" with <a class="link" href="GFile.html" title="GFile"><span class="type">GFile</span></a> to access
the resource data.</p>
<p>There are two forms of the generated source, the default version uses the compiler support for constructor
and destructor functions (where available) to automatically create and register the <a class="link" href="GResource.html" title="GResource"><span class="type">GResource</span></a> on startup
or library load time. If you pass --manual-register two functions to register/unregister the resource is instead
created. This requires an explicit initialization call in your application/library, but it works on all platforms,
even on the minor ones where this is not available. (Constructor support is available for at least Win32, Mac OS and Linux.)</p>
<p>Note that resource data can point directly into the data segment of e.g. a library, so if you are unloading libraries
during runtime you need to be very careful with keeping around pointers to data from a resource, as this goes away
when the library is unloaded. However, in practice this is not generally a problem, since most resource accesses
is for your own resources, and resource data is often used once, during parsing, and then released.</p>
</div>
<div class="refsect1">
<a name="GResource.functions_details"></a><h2>Functions</h2>
<div class="refsect2">
<a name="g-resource-load"></a><h3>g_resource_load ()</h3>
<pre class="programlisting"><a class="link" href="GResource.html" title="GResource"><span class="returnvalue">GResource</span></a> *
g_resource_load (<em class="parameter"><code>const <a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#gchar"><span class="type">gchar</span></a> *filename</code></em>,
                 <em class="parameter"><code><a href="https://developer.gnome.org/glib/unstable/glib-Error-Reporting.html#GError"><span class="type">GError</span></a> **error</code></em>);</pre>
<p>Loads a binary resource bundle and creates a <a class="link" href="GResource.html" title="GResource"><span class="type">GResource</span></a> representation of it, allowing
you to query it for data.</p>
<p>If you want to use this resource in the global resource namespace you need
to register it with <a class="link" href="GResource.html#g-resources-register" title="g_resources_register ()"><code class="function">g_resources_register()</code></a>.</p>
<div class="refsect3">
<a name="id-1.4.20.2.8.2.6"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody>
<tr>
<td class="parameter_name"><p>filename</p></td>
<td class="parameter_description"><p> the path of a filename to load, in the GLib filename encoding. </p></td>
<td class="parameter_annotations"><span class="annotation">[<acronym title="Override the parsed C type with given type."><span class="acronym">type</span></acronym> filename]</span></td>
</tr>
<tr>
<td class="parameter_name"><p>error</p></td>
<td class="parameter_description"><p>return location for a <a href="https://developer.gnome.org/glib/unstable/glib-Error-Reporting.html#GError"><span class="type">GError</span></a>, or <a href="https://developer.gnome.org/glib/unstable/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a></p></td>
<td class="parameter_annotations"> </td>
</tr>
</tbody>
</table></div>
</div>
<div class="refsect3">
<a name="id-1.4.20.2.8.2.7"></a><h4>Returns</h4>
<p> a new <a class="link" href="GResource.html" title="GResource"><span class="type">GResource</span></a>, or <a href="https://developer.gnome.org/glib/unstable/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> on error. </p>
<p><span class="annotation">[<acronym title="Free data after the code is done."><span class="acronym">transfer full</span></acronym>]</span></p>
</div>
<p class="since">Since: <a class="link" href="api-index-2-32.html#api-index-2.32">2.32</a></p>
</div>
<hr>
<div class="refsect2">
<a name="g-resource-new-from-data"></a><h3>g_resource_new_from_data ()</h3>
<pre class="programlisting"><a class="link" href="GResource.html" title="GResource"><span class="returnvalue">GResource</span></a> *
g_resource_new_from_data (<em class="parameter"><code><a href="https://developer.gnome.org/glib/unstable/glib-Byte-Arrays.html#GBytes"><span class="type">GBytes</span></a> *data</code></em>,
                          <em class="parameter"><code><a href="https://developer.gnome.org/glib/unstable/glib-Error-Reporting.html#GError"><span class="type">GError</span></a> **error</code></em>);</pre>
<p>Creates a GResource from a reference to the binary resource bundle.
This will keep a reference to <em class="parameter"><code>data</code></em>
 while the resource lives, so
the data should not be modified or freed.</p>
<p>If you want to use this resource in the global resource namespace you need
to register it with <a class="link" href="GResource.html#g-resources-register" title="g_resources_register ()"><code class="function">g_resources_register()</code></a>.</p>
<div class="refsect3">
<a name="id-1.4.20.2.8.3.6"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody>
<tr>
<td class="parameter_name"><p>data</p></td>
<td class="parameter_description"><p>A <a href="https://developer.gnome.org/glib/unstable/glib-Byte-Arrays.html#GBytes"><span class="type">GBytes</span></a></p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>error</p></td>
<td class="parameter_description"><p>return location for a <a href="https://developer.gnome.org/glib/unstable/glib-Error-Reporting.html#GError"><span class="type">GError</span></a>, or <a href="https://developer.gnome.org/glib/unstable/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a></p></td>
<td class="parameter_annotations"> </td>
</tr>
</tbody>
</table></div>
</div>
<div class="refsect3">
<a name="id-1.4.20.2.8.3.7"></a><h4>Returns</h4>
<p> a new <a class="link" href="GResource.html" title="GResource"><span class="type">GResource</span></a>, or <a href="https://developer.gnome.org/glib/unstable/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> on error. </p>
<p><span class="annotation">[<acronym title="Free data after the code is done."><span class="acronym">transfer full</span></acronym>]</span></p>
</div>
<p class="since">Since: <a class="link" href="api-index-2-32.html#api-index-2.32">2.32</a></p>
</div>
<hr>
<div class="refsect2">
<a name="g-resource-ref"></a><h3>g_resource_ref ()</h3>
<pre class="programlisting"><a class="link" href="GResource.html" title="GResource"><span class="returnvalue">GResource</span></a> *
g_resource_ref (<em class="parameter"><code><a class="link" href="GResource.html" title="GResource"><span class="type">GResource</span></a> *resource</code></em>);</pre>
<p>Atomically increments the reference count of <em class="parameter"><code>resource</code></em>
 by one. This
function is MT-safe and may be called from any thread.</p>
<div class="refsect3">
<a name="id-1.4.20.2.8.4.5"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody><tr>
<td class="parameter_name"><p>resource</p></td>
<td class="parameter_description"><p>A <a class="link" href="GResource.html" title="GResource"><span class="type">GResource</span></a></p></td>
<td class="parameter_annotations"> </td>
</tr></tbody>
</table></div>
</div>
<div class="refsect3">
<a name="id-1.4.20.2.8.4.6"></a><h4>Returns</h4>
<p> The passed in <a class="link" href="GResource.html" title="GResource"><span class="type">GResource</span></a></p>
</div>
<p class="since">Since: <a class="link" href="api-index-2-32.html#api-index-2.32">2.32</a></p>
</div>
<hr>
<div class="refsect2">
<a name="g-resource-unref"></a><h3>g_resource_unref ()</h3>
<pre class="programlisting"><span class="returnvalue">void</span>
g_resource_unref (<em class="parameter"><code><a class="link" href="GResource.html" title="GResource"><span class="type">GResource</span></a> *resource</code></em>);</pre>
<p>Atomically decrements the reference count of <em class="parameter"><code>resource</code></em>
 by one. If the
reference count drops to 0, all memory allocated by the resource is
released. This function is MT-safe and may be called from any
thread.</p>
<div class="refsect3">
<a name="id-1.4.20.2.8.5.5"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody><tr>
<td class="parameter_name"><p>resource</p></td>
<td class="parameter_description"><p>A <a class="link" href="GResource.html" title="GResource"><span class="type">GResource</span></a></p></td>
<td class="parameter_annotations"> </td>
</tr></tbody>
</table></div>
</div>
<p class="since">Since: <a class="link" href="api-index-2-32.html#api-index-2.32">2.32</a></p>
</div>
<hr>
<div class="refsect2">
<a name="g-resource-lookup-data"></a><h3>g_resource_lookup_data ()</h3>
<pre class="programlisting"><a href="https://developer.gnome.org/glib/unstable/glib-Byte-Arrays.html#GBytes"><span class="returnvalue">GBytes</span></a> *
g_resource_lookup_data (<em class="parameter"><code><a class="link" href="GResource.html" title="GResource"><span class="type">GResource</span></a> *resource</code></em>,
                        <em class="parameter"><code>const <span class="type">char</span> *path</code></em>,
                        <em class="parameter"><code><a class="link" href="GResource.html#GResourceLookupFlags" title="enum GResourceLookupFlags"><span class="type">GResourceLookupFlags</span></a> lookup_flags</code></em>,
                        <em class="parameter"><code><a href="https://developer.gnome.org/glib/unstable/glib-Error-Reporting.html#GError"><span class="type">GError</span></a> **error</code></em>);</pre>
<p>Looks for a file at the specified <em class="parameter"><code>path</code></em>
 in the resource and
returns a <a href="https://developer.gnome.org/glib/unstable/glib-Byte-Arrays.html#GBytes"><span class="type">GBytes</span></a> that lets you directly access the data in
memory.</p>
<p>The data is always followed by a zero byte, so you
can safely use the data as a C string. However, that byte
is not included in the size of the GBytes.</p>
<p>For uncompressed resource files this is a pointer directly into
the resource bundle, which is typically in some readonly data section
in the program binary. For compressed files we allocate memory on
the heap and automatically uncompress the data.</p>
<p><em class="parameter"><code>lookup_flags</code></em>
 controls the behaviour of the lookup.</p>
<div class="refsect3">
<a name="id-1.4.20.2.8.6.8"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody>
<tr>
<td class="parameter_name"><p>resource</p></td>
<td class="parameter_description"><p>A <a class="link" href="GResource.html" title="GResource"><span class="type">GResource</span></a></p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>path</p></td>
<td class="parameter_description"><p>A pathname inside the resource</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>lookup_flags</p></td>
<td class="parameter_description"><p>A <a class="link" href="GResource.html#GResourceLookupFlags" title="enum GResourceLookupFlags"><span class="type">GResourceLookupFlags</span></a></p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>error</p></td>
<td class="parameter_description"><p>return location for a <a href="https://developer.gnome.org/glib/unstable/glib-Error-Reporting.html#GError"><span class="type">GError</span></a>, or <a href="https://developer.gnome.org/glib/unstable/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a></p></td>
<td class="parameter_annotations"> </td>
</tr>
</tbody>
</table></div>
</div>
<div class="refsect3">
<a name="id-1.4.20.2.8.6.9"></a><h4>Returns</h4>
<p> <a href="https://developer.gnome.org/glib/unstable/glib-Byte-Arrays.html#GBytes"><span class="type">GBytes</span></a> or <a href="https://developer.gnome.org/glib/unstable/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> on error.
Free the returned object with <a href="https://developer.gnome.org/glib/unstable/glib-Byte-Arrays.html#g-bytes-unref"><code class="function">g_bytes_unref()</code></a>. </p>
<p><span class="annotation">[<acronym title="Free data after the code is done."><span class="acronym">transfer full</span></acronym>]</span></p>
</div>
<p class="since">Since: <a class="link" href="api-index-2-32.html#api-index-2.32">2.32</a></p>
</div>
<hr>
<div class="refsect2">
<a name="g-resource-open-stream"></a><h3>g_resource_open_stream ()</h3>
<pre class="programlisting"><a class="link" href="GInputStream.html" title="GInputStream"><span class="returnvalue">GInputStream</span></a> *
g_resource_open_stream (<em class="parameter"><code><a class="link" href="GResource.html" title="GResource"><span class="type">GResource</span></a> *resource</code></em>,
                        <em class="parameter"><code>const <span class="type">char</span> *path</code></em>,
                        <em class="parameter"><code><a class="link" href="GResource.html#GResourceLookupFlags" title="enum GResourceLookupFlags"><span class="type">GResourceLookupFlags</span></a> lookup_flags</code></em>,
                        <em class="parameter"><code><a href="https://developer.gnome.org/glib/unstable/glib-Error-Reporting.html#GError"><span class="type">GError</span></a> **error</code></em>);</pre>
<p>Looks for a file at the specified <em class="parameter"><code>path</code></em>
 in the resource and
returns a <a class="link" href="GInputStream.html" title="GInputStream"><span class="type">GInputStream</span></a> that lets you read the data.</p>
<p><em class="parameter"><code>lookup_flags</code></em>
 controls the behaviour of the lookup.</p>
<div class="refsect3">
<a name="id-1.4.20.2.8.7.6"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody>
<tr>
<td class="parameter_name"><p>resource</p></td>
<td class="parameter_description"><p>A <a class="link" href="GResource.html" title="GResource"><span class="type">GResource</span></a></p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>path</p></td>
<td class="parameter_description"><p>A pathname inside the resource</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>lookup_flags</p></td>
<td class="parameter_description"><p>A <a class="link" href="GResource.html#GResourceLookupFlags" title="enum GResourceLookupFlags"><span class="type">GResourceLookupFlags</span></a></p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>error</p></td>
<td class="parameter_description"><p>return location for a <a href="https://developer.gnome.org/glib/unstable/glib-Error-Reporting.html#GError"><span class="type">GError</span></a>, or <a href="https://developer.gnome.org/glib/unstable/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a></p></td>
<td class="parameter_annotations"> </td>
</tr>
</tbody>
</table></div>
</div>
<div class="refsect3">
<a name="id-1.4.20.2.8.7.7"></a><h4>Returns</h4>
<p> <a class="link" href="GInputStream.html" title="GInputStream"><span class="type">GInputStream</span></a> or <a href="https://developer.gnome.org/glib/unstable/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> on error.
Free the returned object with <a href="https://developer.gnome.org/gobject/unstable/gobject-The-Base-Object-Type.html#g-object-unref"><code class="function">g_object_unref()</code></a>. </p>
<p><span class="annotation">[<acronym title="Free data after the code is done."><span class="acronym">transfer full</span></acronym>]</span></p>
</div>
<p class="since">Since: <a class="link" href="api-index-2-32.html#api-index-2.32">2.32</a></p>
</div>
<hr>
<div class="refsect2">
<a name="g-resource-enumerate-children"></a><h3>g_resource_enumerate_children ()</h3>
<pre class="programlisting"><span class="returnvalue">char</span> **
g_resource_enumerate_children (<em class="parameter"><code><a class="link" href="GResource.html" title="GResource"><span class="type">GResource</span></a> *resource</code></em>,
                               <em class="parameter"><code>const <span class="type">char</span> *path</code></em>,
                               <em class="parameter"><code><a class="link" href="GResource.html#GResourceLookupFlags" title="enum GResourceLookupFlags"><span class="type">GResourceLookupFlags</span></a> lookup_flags</code></em>,
                               <em class="parameter"><code><a href="https://developer.gnome.org/glib/unstable/glib-Error-Reporting.html#GError"><span class="type">GError</span></a> **error</code></em>);</pre>
<p>Returns all the names of children at the specified <em class="parameter"><code>path</code></em>
 in the resource.
The return result is a <a href="https://developer.gnome.org/glib/unstable/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> terminated list of strings which should
be released with <a href="https://developer.gnome.org/glib/unstable/glib-String-Utility-Functions.html#g-strfreev"><code class="function">g_strfreev()</code></a>.</p>
<p>If <em class="parameter"><code>path</code></em>
 is invalid or does not exist in the <a class="link" href="GResource.html" title="GResource"><span class="type">GResource</span></a>,
<a class="link" href="GResource.html#G-RESOURCE-ERROR-NOT-FOUND:CAPS"><code class="literal">G_RESOURCE_ERROR_NOT_FOUND</code></a> will be returned.</p>
<p><em class="parameter"><code>lookup_flags</code></em>
 controls the behaviour of the lookup.</p>
<div class="refsect3">
<a name="id-1.4.20.2.8.8.7"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody>
<tr>
<td class="parameter_name"><p>resource</p></td>
<td class="parameter_description"><p>A <a class="link" href="GResource.html" title="GResource"><span class="type">GResource</span></a></p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>path</p></td>
<td class="parameter_description"><p>A pathname inside the resource</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>lookup_flags</p></td>
<td class="parameter_description"><p>A <a class="link" href="GResource.html#GResourceLookupFlags" title="enum GResourceLookupFlags"><span class="type">GResourceLookupFlags</span></a></p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>error</p></td>
<td class="parameter_description"><p>return location for a <a href="https://developer.gnome.org/glib/unstable/glib-Error-Reporting.html#GError"><span class="type">GError</span></a>, or <a href="https://developer.gnome.org/glib/unstable/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a></p></td>
<td class="parameter_annotations"> </td>
</tr>
</tbody>
</table></div>
</div>
<div class="refsect3">
<a name="id-1.4.20.2.8.8.8"></a><h4>Returns</h4>
<p> an array of constant strings. </p>
<p><span class="annotation">[<acronym title="Parameter points to an array of items."><span class="acronym">array</span></acronym> zero-terminated=1][<acronym title="Free data after the code is done."><span class="acronym">transfer full</span></acronym>]</span></p>
</div>
<p class="since">Since: <a class="link" href="api-index-2-32.html#api-index-2.32">2.32</a></p>
</div>
<hr>
<div class="refsect2">
<a name="g-resource-get-info"></a><h3>g_resource_get_info ()</h3>
<pre class="programlisting"><a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>
g_resource_get_info (<em class="parameter"><code><a class="link" href="GResource.html" title="GResource"><span class="type">GResource</span></a> *resource</code></em>,
                     <em class="parameter"><code>const <span class="type">char</span> *path</code></em>,
                     <em class="parameter"><code><a class="link" href="GResource.html#GResourceLookupFlags" title="enum GResourceLookupFlags"><span class="type">GResourceLookupFlags</span></a> lookup_flags</code></em>,
                     <em class="parameter"><code><a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#gsize"><span class="type">gsize</span></a> *size</code></em>,
                     <em class="parameter"><code><a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#guint32"><span class="type">guint32</span></a> *flags</code></em>,
                     <em class="parameter"><code><a href="https://developer.gnome.org/glib/unstable/glib-Error-Reporting.html#GError"><span class="type">GError</span></a> **error</code></em>);</pre>
<p>Looks for a file at the specified <em class="parameter"><code>path</code></em>
 in the resource and
if found returns information about it.</p>
<p><em class="parameter"><code>lookup_flags</code></em>
 controls the behaviour of the lookup.</p>
<div class="refsect3">
<a name="id-1.4.20.2.8.9.6"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody>
<tr>
<td class="parameter_name"><p>resource</p></td>
<td class="parameter_description"><p>A <a class="link" href="GResource.html" title="GResource"><span class="type">GResource</span></a></p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>path</p></td>
<td class="parameter_description"><p>A pathname inside the resource</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>lookup_flags</p></td>
<td class="parameter_description"><p>A <a class="link" href="GResource.html#GResourceLookupFlags" title="enum GResourceLookupFlags"><span class="type">GResourceLookupFlags</span></a></p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>size</p></td>
<td class="parameter_description"><p> a location to place the length of the contents of the file,
or <a href="https://developer.gnome.org/glib/unstable/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> if the length is not needed. </p></td>
<td class="parameter_annotations"><span class="annotation">[<acronym title="Parameter for returning results. Default is transfer full."><span class="acronym">out</span></acronym>][<acronym title="NULL is OK, both for passing and for returning."><span class="acronym">allow-none</span></acronym>]</span></td>
</tr>
<tr>
<td class="parameter_name"><p>flags</p></td>
<td class="parameter_description"><p> a location to place the flags about the file,
or <a href="https://developer.gnome.org/glib/unstable/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> if the length is not needed. </p></td>
<td class="parameter_annotations"><span class="annotation">[<acronym title="Parameter for returning results. Default is transfer full."><span class="acronym">out</span></acronym>][<acronym title="NULL is OK, both for passing and for returning."><span class="acronym">allow-none</span></acronym>]</span></td>
</tr>
<tr>
<td class="parameter_name"><p>error</p></td>
<td class="parameter_description"><p>return location for a <a href="https://developer.gnome.org/glib/unstable/glib-Error-Reporting.html#GError"><span class="type">GError</span></a>, or <a href="https://developer.gnome.org/glib/unstable/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a></p></td>
<td class="parameter_annotations"> </td>
</tr>
</tbody>
</table></div>
</div>
<div class="refsect3">
<a name="id-1.4.20.2.8.9.7"></a><h4>Returns</h4>
<p> <a href="https://developer.gnome.org/glib/unstable/glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a> if the file was found. <a href="https://developer.gnome.org/glib/unstable/glib-Standard-Macros.html#FALSE:CAPS"><code class="literal">FALSE</code></a> if there were errors</p>
</div>
<p class="since">Since: <a class="link" href="api-index-2-32.html#api-index-2.32">2.32</a></p>
</div>
<hr>
<div class="refsect2">
<a name="g-static-resource-init"></a><h3>g_static_resource_init ()</h3>
<pre class="programlisting"><span class="returnvalue">void</span>
g_static_resource_init (<em class="parameter"><code><a class="link" href="GResource.html#GStaticResource" title="struct GStaticResource"><span class="type">GStaticResource</span></a> *static_resource</code></em>);</pre>
<p>Initializes a GResource from static data using a
GStaticResource.</p>
<p>This is normally used by code generated by
<a href="glib-compile-resources.html">glib-compile-resources</a>
and is not typically used by other code.</p>
<div class="refsect3">
<a name="id-1.4.20.2.8.10.6"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody><tr>
<td class="parameter_name"><p>static_resource</p></td>
<td class="parameter_description"><p>pointer to a static <a class="link" href="GResource.html#GStaticResource" title="struct GStaticResource"><span class="type">GStaticResource</span></a></p></td>
<td class="parameter_annotations"> </td>
</tr></tbody>
</table></div>
</div>
<p class="since">Since: <a class="link" href="api-index-2-32.html#api-index-2.32">2.32</a></p>
</div>
<hr>
<div class="refsect2">
<a name="g-static-resource-fini"></a><h3>g_static_resource_fini ()</h3>
<pre class="programlisting"><span class="returnvalue">void</span>
g_static_resource_fini (<em class="parameter"><code><a class="link" href="GResource.html#GStaticResource" title="struct GStaticResource"><span class="type">GStaticResource</span></a> *static_resource</code></em>);</pre>
<p>Finalized a GResource initialized by <a class="link" href="GResource.html#g-static-resource-init" title="g_static_resource_init ()"><code class="function">g_static_resource_init()</code></a>.</p>
<p>This is normally used by code generated by
<a href="glib-compile-resources.html">glib-compile-resources</a>
and is not typically used by other code.</p>
<div class="refsect3">
<a name="id-1.4.20.2.8.11.6"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody><tr>
<td class="parameter_name"><p>static_resource</p></td>
<td class="parameter_description"><p>pointer to a static <a class="link" href="GResource.html#GStaticResource" title="struct GStaticResource"><span class="type">GStaticResource</span></a></p></td>
<td class="parameter_annotations"> </td>
</tr></tbody>
</table></div>
</div>
<p class="since">Since: <a class="link" href="api-index-2-32.html#api-index-2.32">2.32</a></p>
</div>
<hr>
<div class="refsect2">
<a name="g-static-resource-get-resource"></a><h3>g_static_resource_get_resource ()</h3>
<pre class="programlisting"><a class="link" href="GResource.html" title="GResource"><span class="returnvalue">GResource</span></a> *
g_static_resource_get_resource (<em class="parameter"><code><a class="link" href="GResource.html#GStaticResource" title="struct GStaticResource"><span class="type">GStaticResource</span></a> *static_resource</code></em>);</pre>
<p>Gets the GResource that was registered by a call to <a class="link" href="GResource.html#g-static-resource-init" title="g_static_resource_init ()"><code class="function">g_static_resource_init()</code></a>.</p>
<p>This is normally used by code generated by
<a href="glib-compile-resources.html">glib-compile-resources</a>
and is not typically used by other code.</p>
<div class="refsect3">
<a name="id-1.4.20.2.8.12.6"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody><tr>
<td class="parameter_name"><p>static_resource</p></td>
<td class="parameter_description"><p>pointer to a static <a class="link" href="GResource.html#GStaticResource" title="struct GStaticResource"><span class="type">GStaticResource</span></a></p></td>
<td class="parameter_annotations"> </td>
</tr></tbody>
</table></div>
</div>
<div class="refsect3">
<a name="id-1.4.20.2.8.12.7"></a><h4>Returns</h4>
<p> a <a class="link" href="GResource.html" title="GResource"><span class="type">GResource</span></a>. </p>
<p><span class="annotation">[<acronym title="Don't free data after the code is done."><span class="acronym">transfer none</span></acronym>]</span></p>
</div>
<p class="since">Since: <a class="link" href="api-index-2-32.html#api-index-2.32">2.32</a></p>
</div>
<hr>
<div class="refsect2">
<a name="g-resources-register"></a><h3>g_resources_register ()</h3>
<pre class="programlisting"><span class="returnvalue">void</span>
g_resources_register (<em class="parameter"><code><a class="link" href="GResource.html" title="GResource"><span class="type">GResource</span></a> *resource</code></em>);</pre>
<p>Registers the resource with the process-global set of resources.
Once a resource is registered the files in it can be accessed
with the global resource lookup functions like <a class="link" href="GResource.html#g-resources-lookup-data" title="g_resources_lookup_data ()"><code class="function">g_resources_lookup_data()</code></a>.</p>
<div class="refsect3">
<a name="id-1.4.20.2.8.13.5"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody><tr>
<td class="parameter_name"><p>resource</p></td>
<td class="parameter_description"><p>A <a class="link" href="GResource.html" title="GResource"><span class="type">GResource</span></a></p></td>
<td class="parameter_annotations"> </td>
</tr></tbody>
</table></div>
</div>
<p class="since">Since: <a class="link" href="api-index-2-32.html#api-index-2.32">2.32</a></p>
</div>
<hr>
<div class="refsect2">
<a name="g-resources-unregister"></a><h3>g_resources_unregister ()</h3>
<pre class="programlisting"><span class="returnvalue">void</span>
g_resources_unregister (<em class="parameter"><code><a class="link" href="GResource.html" title="GResource"><span class="type">GResource</span></a> *resource</code></em>);</pre>
<p>Unregisters the resource from the process-global set of resources.</p>
<div class="refsect3">
<a name="id-1.4.20.2.8.14.5"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody><tr>
<td class="parameter_name"><p>resource</p></td>
<td class="parameter_description"><p>A <a class="link" href="GResource.html" title="GResource"><span class="type">GResource</span></a></p></td>
<td class="parameter_annotations"> </td>
</tr></tbody>
</table></div>
</div>
<p class="since">Since: <a class="link" href="api-index-2-32.html#api-index-2.32">2.32</a></p>
</div>
<hr>
<div class="refsect2">
<a name="g-resources-lookup-data"></a><h3>g_resources_lookup_data ()</h3>
<pre class="programlisting"><a href="https://developer.gnome.org/glib/unstable/glib-Byte-Arrays.html#GBytes"><span class="returnvalue">GBytes</span></a> *
g_resources_lookup_data (<em class="parameter"><code>const <span class="type">char</span> *path</code></em>,
                         <em class="parameter"><code><a class="link" href="GResource.html#GResourceLookupFlags" title="enum GResourceLookupFlags"><span class="type">GResourceLookupFlags</span></a> lookup_flags</code></em>,
                         <em class="parameter"><code><a href="https://developer.gnome.org/glib/unstable/glib-Error-Reporting.html#GError"><span class="type">GError</span></a> **error</code></em>);</pre>
<p>Looks for a file at the specified <em class="parameter"><code>path</code></em>
 in the set of
globally registered resources and returns a <a href="https://developer.gnome.org/glib/unstable/glib-Byte-Arrays.html#GBytes"><span class="type">GBytes</span></a> that
lets you directly access the data in memory.</p>
<p>The data is always followed by a zero byte, so you
can safely use the data as a C string. However, that byte
is not included in the size of the GBytes.</p>
<p>For uncompressed resource files this is a pointer directly into
the resource bundle, which is typically in some readonly data section
in the program binary. For compressed files we allocate memory on
the heap and automatically uncompress the data.</p>
<p><em class="parameter"><code>lookup_flags</code></em>
 controls the behaviour of the lookup.</p>
<div class="refsect3">
<a name="id-1.4.20.2.8.15.8"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody>
<tr>
<td class="parameter_name"><p>path</p></td>
<td class="parameter_description"><p>A pathname inside the resource</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>lookup_flags</p></td>
<td class="parameter_description"><p>A <a class="link" href="GResource.html#GResourceLookupFlags" title="enum GResourceLookupFlags"><span class="type">GResourceLookupFlags</span></a></p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>error</p></td>
<td class="parameter_description"><p>return location for a <a href="https://developer.gnome.org/glib/unstable/glib-Error-Reporting.html#GError"><span class="type">GError</span></a>, or <a href="https://developer.gnome.org/glib/unstable/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a></p></td>
<td class="parameter_annotations"> </td>
</tr>
</tbody>
</table></div>
</div>
<div class="refsect3">
<a name="id-1.4.20.2.8.15.9"></a><h4>Returns</h4>
<p> <a href="https://developer.gnome.org/glib/unstable/glib-Byte-Arrays.html#GBytes"><span class="type">GBytes</span></a> or <a href="https://developer.gnome.org/glib/unstable/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> on error.
Free the returned object with <a href="https://developer.gnome.org/glib/unstable/glib-Byte-Arrays.html#g-bytes-unref"><code class="function">g_bytes_unref()</code></a>. </p>
<p><span class="annotation">[<acronym title="Free data after the code is done."><span class="acronym">transfer full</span></acronym>]</span></p>
</div>
<p class="since">Since: <a class="link" href="api-index-2-32.html#api-index-2.32">2.32</a></p>
</div>
<hr>
<div class="refsect2">
<a name="g-resources-open-stream"></a><h3>g_resources_open_stream ()</h3>
<pre class="programlisting"><a class="link" href="GInputStream.html" title="GInputStream"><span class="returnvalue">GInputStream</span></a> *
g_resources_open_stream (<em class="parameter"><code>const <span class="type">char</span> *path</code></em>,
                         <em class="parameter"><code><a class="link" href="GResource.html#GResourceLookupFlags" title="enum GResourceLookupFlags"><span class="type">GResourceLookupFlags</span></a> lookup_flags</code></em>,
                         <em class="parameter"><code><a href="https://developer.gnome.org/glib/unstable/glib-Error-Reporting.html#GError"><span class="type">GError</span></a> **error</code></em>);</pre>
<p>Looks for a file at the specified <em class="parameter"><code>path</code></em>
 in the set of
globally registered resources and returns a <a class="link" href="GInputStream.html" title="GInputStream"><span class="type">GInputStream</span></a>
that lets you read the data.</p>
<p><em class="parameter"><code>lookup_flags</code></em>
 controls the behaviour of the lookup.</p>
<div class="refsect3">
<a name="id-1.4.20.2.8.16.6"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody>
<tr>
<td class="parameter_name"><p>path</p></td>
<td class="parameter_description"><p>A pathname inside the resource</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>lookup_flags</p></td>
<td class="parameter_description"><p>A <a class="link" href="GResource.html#GResourceLookupFlags" title="enum GResourceLookupFlags"><span class="type">GResourceLookupFlags</span></a></p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>error</p></td>
<td class="parameter_description"><p>return location for a <a href="https://developer.gnome.org/glib/unstable/glib-Error-Reporting.html#GError"><span class="type">GError</span></a>, or <a href="https://developer.gnome.org/glib/unstable/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a></p></td>
<td class="parameter_annotations"> </td>
</tr>
</tbody>
</table></div>
</div>
<div class="refsect3">
<a name="id-1.4.20.2.8.16.7"></a><h4>Returns</h4>
<p> <a class="link" href="GInputStream.html" title="GInputStream"><span class="type">GInputStream</span></a> or <a href="https://developer.gnome.org/glib/unstable/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> on error.
Free the returned object with <a href="https://developer.gnome.org/gobject/unstable/gobject-The-Base-Object-Type.html#g-object-unref"><code class="function">g_object_unref()</code></a>. </p>
<p><span class="annotation">[<acronym title="Free data after the code is done."><span class="acronym">transfer full</span></acronym>]</span></p>
</div>
<p class="since">Since: <a class="link" href="api-index-2-32.html#api-index-2.32">2.32</a></p>
</div>
<hr>
<div class="refsect2">
<a name="g-resources-enumerate-children"></a><h3>g_resources_enumerate_children ()</h3>
<pre class="programlisting"><span class="returnvalue">char</span> **
g_resources_enumerate_children (<em class="parameter"><code>const <span class="type">char</span> *path</code></em>,
                                <em class="parameter"><code><a class="link" href="GResource.html#GResourceLookupFlags" title="enum GResourceLookupFlags"><span class="type">GResourceLookupFlags</span></a> lookup_flags</code></em>,
                                <em class="parameter"><code><a href="https://developer.gnome.org/glib/unstable/glib-Error-Reporting.html#GError"><span class="type">GError</span></a> **error</code></em>);</pre>
<p>Returns all the names of children at the specified <em class="parameter"><code>path</code></em>
 in the set of
globally registered resources.
The return result is a <a href="https://developer.gnome.org/glib/unstable/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> terminated list of strings which should
be released with <a href="https://developer.gnome.org/glib/unstable/glib-String-Utility-Functions.html#g-strfreev"><code class="function">g_strfreev()</code></a>.</p>
<p><em class="parameter"><code>lookup_flags</code></em>
 controls the behaviour of the lookup.</p>
<div class="refsect3">
<a name="id-1.4.20.2.8.17.6"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody>
<tr>
<td class="parameter_name"><p>path</p></td>
<td class="parameter_description"><p>A pathname inside the resource</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>lookup_flags</p></td>
<td class="parameter_description"><p>A <a class="link" href="GResource.html#GResourceLookupFlags" title="enum GResourceLookupFlags"><span class="type">GResourceLookupFlags</span></a></p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>error</p></td>
<td class="parameter_description"><p>return location for a <a href="https://developer.gnome.org/glib/unstable/glib-Error-Reporting.html#GError"><span class="type">GError</span></a>, or <a href="https://developer.gnome.org/glib/unstable/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a></p></td>
<td class="parameter_annotations"> </td>
</tr>
</tbody>
</table></div>
</div>
<div class="refsect3">
<a name="id-1.4.20.2.8.17.7"></a><h4>Returns</h4>
<p> an array of constant strings. </p>
<p><span class="annotation">[<acronym title="Parameter points to an array of items."><span class="acronym">array</span></acronym> zero-terminated=1][<acronym title="Free data after the code is done."><span class="acronym">transfer full</span></acronym>]</span></p>
</div>
<p class="since">Since: <a class="link" href="api-index-2-32.html#api-index-2.32">2.32</a></p>
</div>
<hr>
<div class="refsect2">
<a name="g-resources-get-info"></a><h3>g_resources_get_info ()</h3>
<pre class="programlisting"><a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>
g_resources_get_info (<em class="parameter"><code>const <span class="type">char</span> *path</code></em>,
                      <em class="parameter"><code><a class="link" href="GResource.html#GResourceLookupFlags" title="enum GResourceLookupFlags"><span class="type">GResourceLookupFlags</span></a> lookup_flags</code></em>,
                      <em class="parameter"><code><a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#gsize"><span class="type">gsize</span></a> *size</code></em>,
                      <em class="parameter"><code><a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#guint32"><span class="type">guint32</span></a> *flags</code></em>,
                      <em class="parameter"><code><a href="https://developer.gnome.org/glib/unstable/glib-Error-Reporting.html#GError"><span class="type">GError</span></a> **error</code></em>);</pre>
<p>Looks for a file at the specified <em class="parameter"><code>path</code></em>
 in the set of
globally registered resources and if found returns information about it.</p>
<p><em class="parameter"><code>lookup_flags</code></em>
 controls the behaviour of the lookup.</p>
<div class="refsect3">
<a name="id-1.4.20.2.8.18.6"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody>
<tr>
<td class="parameter_name"><p>path</p></td>
<td class="parameter_description"><p>A pathname inside the resource</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>lookup_flags</p></td>
<td class="parameter_description"><p>A <a class="link" href="GResource.html#GResourceLookupFlags" title="enum GResourceLookupFlags"><span class="type">GResourceLookupFlags</span></a></p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>size</p></td>
<td class="parameter_description"><p> a location to place the length of the contents of the file,
or <a href="https://developer.gnome.org/glib/unstable/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> if the length is not needed. </p></td>
<td class="parameter_annotations"><span class="annotation">[<acronym title="Parameter for returning results. Default is transfer full."><span class="acronym">out</span></acronym>][<acronym title="NULL is OK, both for passing and for returning."><span class="acronym">allow-none</span></acronym>]</span></td>
</tr>
<tr>
<td class="parameter_name"><p>flags</p></td>
<td class="parameter_description"><p> a location to place the flags about the file,
or <a href="https://developer.gnome.org/glib/unstable/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> if the length is not needed. </p></td>
<td class="parameter_annotations"><span class="annotation">[<acronym title="Parameter for returning results. Default is transfer full."><span class="acronym">out</span></acronym>][<acronym title="NULL is OK, both for passing and for returning."><span class="acronym">allow-none</span></acronym>]</span></td>
</tr>
<tr>
<td class="parameter_name"><p>error</p></td>
<td class="parameter_description"><p>return location for a <a href="https://developer.gnome.org/glib/unstable/glib-Error-Reporting.html#GError"><span class="type">GError</span></a>, or <a href="https://developer.gnome.org/glib/unstable/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a></p></td>
<td class="parameter_annotations"> </td>
</tr>
</tbody>
</table></div>
</div>
<div class="refsect3">
<a name="id-1.4.20.2.8.18.7"></a><h4>Returns</h4>
<p> <a href="https://developer.gnome.org/glib/unstable/glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a> if the file was found. <a href="https://developer.gnome.org/glib/unstable/glib-Standard-Macros.html#FALSE:CAPS"><code class="literal">FALSE</code></a> if there were errors</p>
</div>
<p class="since">Since: <a class="link" href="api-index-2-32.html#api-index-2.32">2.32</a></p>
</div>
<hr>
<div class="refsect2">
<a name="G-RESOURCE-ERROR:CAPS"></a><h3>G_RESOURCE_ERROR</h3>
<pre class="programlisting">#define G_RESOURCE_ERROR (g_resource_error_quark ())
</pre>
<p>Error domain for <a class="link" href="GResource.html" title="GResource"><span class="type">GResource</span></a>. Errors in this domain will be from the
<a class="link" href="GResource.html#GResourceError" title="enum GResourceError"><span class="type">GResourceError</span></a> enumeration. See <a href="https://developer.gnome.org/glib/unstable/glib-Error-Reporting.html#GError"><span class="type">GError</span></a> for more information on
error domains.</p>
</div>
</div>
<div class="refsect1">
<a name="GResource.other_details"></a><h2>Types and Values</h2>
<div class="refsect2">
<a name="GResource-struct"></a><h3>GResource</h3>
<pre class="programlisting">typedef struct _GResource GResource;</pre>
<p>A resource bundle.</p>
<p class="since">Since: <a class="link" href="api-index-2-32.html#api-index-2.32">2.32</a></p>
</div>
<hr>
<div class="refsect2">
<a name="GResourceFlags"></a><h3>enum GResourceFlags</h3>
<p>GResourceFlags give information about a particular file inside a resource
bundle.</p>
<div class="refsect3">
<a name="id-1.4.20.2.9.3.4"></a><h4>Members</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="300px" class="enum_members_name">
<col class="enum_members_description">
<col width="200px" class="enum_members_annotations">
</colgroup>
<tbody>
<tr>
<td class="enum_member_name"><p><a name="G-RESOURCE-FLAGS-NONE:CAPS"></a>G_RESOURCE_FLAGS_NONE</p></td>
<td class="enum_member_description">
<p>No flags set.</p>
</td>
<td class="enum_member_annotations"> </td>
</tr>
<tr>
<td class="enum_member_name"><p><a name="G-RESOURCE-FLAGS-COMPRESSED:CAPS"></a>G_RESOURCE_FLAGS_COMPRESSED</p></td>
<td class="enum_member_description">
<p>The file is compressed.</p>
</td>
<td class="enum_member_annotations"> </td>
</tr>
</tbody>
</table></div>
</div>
<p class="since">Since: <a class="link" href="api-index-2-32.html#api-index-2.32">2.32</a></p>
</div>
<hr>
<div class="refsect2">
<a name="GResourceLookupFlags"></a><h3>enum GResourceLookupFlags</h3>
<p>GResourceLookupFlags determine how resource path lookups are handled.</p>
<div class="refsect3">
<a name="id-1.4.20.2.9.4.4"></a><h4>Members</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="300px" class="enum_members_name">
<col class="enum_members_description">
<col width="200px" class="enum_members_annotations">
</colgroup>
<tbody><tr>
<td class="enum_member_name"><p><a name="G-RESOURCE-LOOKUP-FLAGS-NONE:CAPS"></a>G_RESOURCE_LOOKUP_FLAGS_NONE</p></td>
<td class="enum_member_description">
<p>No flags set.</p>
</td>
<td class="enum_member_annotations"> </td>
</tr></tbody>
</table></div>
</div>
<p class="since">Since: <a class="link" href="api-index-2-32.html#api-index-2.32">2.32</a></p>
</div>
<hr>
<div class="refsect2">
<a name="GStaticResource"></a><h3>struct GStaticResource</h3>
<pre class="programlisting">struct GStaticResource {
};
</pre>
<p><a class="link" href="GResource.html#GStaticResource" title="struct GStaticResource"><span class="type">GStaticResource</span></a> is an opaque data structure and can only be accessed
using the following functions.</p>
</div>
<hr>
<div class="refsect2">
<a name="GResourceError"></a><h3>enum GResourceError</h3>
<p>An error code used with <a class="link" href="GResource.html#G-RESOURCE-ERROR:CAPS" title="G_RESOURCE_ERROR"><code class="literal">G_RESOURCE_ERROR</code></a> in a <a href="https://developer.gnome.org/glib/unstable/glib-Error-Reporting.html#GError"><span class="type">GError</span></a> returned
from a <a class="link" href="GResource.html" title="GResource"><span class="type">GResource</span></a> routine.</p>
<div class="refsect3">
<a name="id-1.4.20.2.9.6.4"></a><h4>Members</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="300px" class="enum_members_name">
<col class="enum_members_description">
<col width="200px" class="enum_members_annotations">
</colgroup>
<tbody>
<tr>
<td class="enum_member_name"><p><a name="G-RESOURCE-ERROR-NOT-FOUND:CAPS"></a>G_RESOURCE_ERROR_NOT_FOUND</p></td>
<td class="enum_member_description">
<p>no file was found at the requested path</p>
</td>
<td class="enum_member_annotations"> </td>
</tr>
<tr>
<td class="enum_member_name"><p><a name="G-RESOURCE-ERROR-INTERNAL:CAPS"></a>G_RESOURCE_ERROR_INTERNAL</p></td>
<td class="enum_member_description">
<p>unknown error</p>
</td>
<td class="enum_member_annotations"> </td>
</tr>
</tbody>
</table></div>
</div>
<p class="since">Since: <a class="link" href="api-index-2-32.html#api-index-2.32">2.32</a></p>
</div>
</div>
</div>
<div class="footer">
<hr>Generated by GTK-Doc V1.24</div>
</body>
</html>